{% extends "base.html" %}

{% block title %}CNInfo - 全站搜索{% endblock %}
{% block page_title %}全站搜索{% endblock %}
{% block page_subtitle %}关键词：{{ q or '（未输入）' }}{% endblock %}

{% block extra_css %}
<style>
.group { margin: 16px 0; background:#fff; border:1px solid #f0ead6; border-radius:12px; overflow:hidden; }
.group h3 { margin:0; padding:10px 14px; background:linear-gradient(135deg, #f5f2ed 0%, #ede8e0 100%); color:#5d4e37; font-size:16px; }
.group .list { padding:12px 14px; }
.item { padding:10px 0; border-bottom:1px solid #f7f3e9; }
.item:last-child { border-bottom:none; }
.muted { color:#777; font-size:12px; }
.title a { color:#8b7355; font-weight:600; text-decoration:none; }
.title a:hover { text-decoration:underline; }
</style>
{% endblock %}

{% block content %}
<div>
    {% if not q %}
    <div class="group">
        <h3>提示</h3>
        <div class="list">请输入关键词进行搜索。</div>
    </div>
    {% endif %}

    {% macro ts_to_text(v) -%}
        {%- if v and v|string|length >= 10 -%}
            {%- set _ = v -%}
            {{ v }}
        {%- endif -%}
    {%- endmacro %}

    <div class="group">
        <h3>机构调研（深市）</h3>
        <div class="list">
            {% for it in groups.cninfo %}
            <div class="item">
                <div class="title"><a href="{{ it.url }}" target="_blank">{{ it.title }}</a></div>
                <div class="muted">{{ it.secCode }} {{ it.secName }} · {{ it.time }}</div>
            </div>
            {% else %}
            <div class="item muted">无结果</div>
            {% endfor %}
        </div>
    </div>

    <div class="group">
        <h3>机构调研（沪市）</h3>
        <div class="list">
            {% for it in groups.sse_report %}
            <div class="item">
                <div class="title"><a href="{{ it.url }}" target="_blank">{{ it.title }}</a></div>
                <div class="muted">{{ it.secCode }} {{ it.secName }} · {{ it.time }}</div>
            </div>
            {% else %}
            <div class="item muted">无结果</div>
            {% endfor %}
        </div>
    </div>

    <div class="group">
        <h3>问董秘（沪市）</h3>
        <div class="list">
            {% for it in groups.iwen %}
            <div class="item">
                <div class="title">{{ it.stock_name }}（{{ it.stock_code }}）</div>
                <div class="muted">问：{{ it.question_text }}</div>
                {% if it.answer_text %}
                <div class="muted">答：{{ it.answer_text }}</div>
                {% endif %}
            </div>
            {% else %}
            <div class="item muted">无结果</div>
            {% endfor %}
        </div>
    </div>

    
</div>
{% endblock %}


